# 类装饰器示例

def add_str_method(cls):
    def __str__(self):
        return f"{self.__class__.__name__}({self.__dict__})"
    cls.__str__ = __str__
    return cls

@add_str_method
class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y


# 使用类装饰器
point = Point(1, 2)
print(point)